package offer;

import java.util.ArrayList;
import java.util.List;

@FunctionalInterface
public interface FindKthNumber {
    int findKthNumber(int n, int k);
}

class FindKthNumberTest {
    public static void main(String[] args) {
        new FindKthNumberImpl1().findKthNumber(13, 2);
    }
}

class FindKthNumberImpl1 implements FindKthNumber{

    @Override
    public int findKthNumber(int n, int k) {
        List<String> dict = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            dict.add("" + i);
        }
        dict.sort(String::compareTo);
        return Integer.parseInt(dict.get(k - 1));
    }
}